package com.example.mapper;

import com.example.entity.Menu;
import com.example.entity.Subject;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author： wzz
 * @date： 2021-10-27 15:29
 */


public interface MenuMapper {

    /**
     * 查询所有的课程章节
     * @return
     */
    List<Menu> queryAll();


    /**
     * 根据章节号查询各章节的作业
     * @return
     */
    @Select("select * from subject where menu_topic=#{menu_topic} and book_name=#{book_name}")
    @Results(value = {
            @Result(column = "question_number",property = "question_number"),
            @Result(column = "menu_topic",property = "menu_topic"),
            @Result(column = "book_name",property = "book_name"),
            @Result(column = "type",property = "type"),
            @Result(column = "point",property = "point"),
            @Result(column = "facility",property = "facility"),
            @Result(column = "stem",property = "stem"),
            @Result(column = "option_one",property = "option_one"),
            @Result(column = "option_two",property = "option_two"),
            @Result(column = "option_three",property = "option_three"),
            @Result(column = "option_four",property = "option_four"),
//            @Result(column = "answer",property = "answer"),
    })
    List<Subject> queryByChapterNo(String menu_topic,String book_name);

    /**
     * 添加课程大纲
     * @return
     */
    Integer AddMenu(List<Menu> menuList);
}
